package com.example.shengyin.service;

import com.example.shengyin.dao.AdminMapper;
import com.example.shengyin.dao.SurveyMapper;
import com.example.shengyin.entity.Admin;
import com.example.shengyin.entity.Page;
import com.example.shengyin.entity.Survey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

/**
 * AdminService业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-29
 */
@Service
//@Transactional(readOnly = true, timeout = -1, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
@Cacheable(cacheNames = "survey",keyGenerator = "root")
public class SurveyService
{

    @Autowired
    private SurveyMapper dao;
    public Survey select(Long id)
    {
        return dao.select(id);
    }
    public List<Survey> selectus(Long userid)
    {
        return dao.selectus(userid);
    }
    public List<Survey> list(Page page, String phone,Long stape)
    {
       return dao.list((page.getPage()-1)*page.getLimit(),page.getLimit(), phone, stape);
    }


    public int count(String phone,Long stape)
    {
       return dao.count(phone,stape);
    }
    @CacheEvict(allEntries = true,cacheNames = "survey")
    public int insert(Survey dAdmin)
    {
        return dao.insert(dAdmin);
    }
    @CacheEvict(allEntries = true,cacheNames = "survey")
    public int update(Survey dAdmin)
    {
        return dao.update(dAdmin);
    }
    @CacheEvict(allEntries = true,cacheNames = "survey")
    public int deleteByIds(String ids)
    {
        return dao.deleteByIds(ids);
    }
    @CacheEvict(allEntries = true,cacheNames = "survey")
    public int delete(Long id)
    {
        return dao.delete(id);
    }
    @CacheEvict(allEntries = true,cacheNames = "survey")
    public Long selectid(String s) {
        return dao.selectid(s);
    }
}
